import 'package:flutter/material.dart';

/// 姿态绘制组件
/// 负责在屏幕上绘制检测到的姿态关键点
/// 创建时间：2024-01-23

class PosePainter extends CustomPainter {
  final List<dynamic> poses;
  final List<Offset> points;
  final Size imageSize;

  PosePainter(this.poses, this.points, this.imageSize);

  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint()
      ..color = Colors.red
      ..strokeWidth = 4
      ..style = PaintingStyle.stroke;

    for (final point in points) {
      canvas.drawCircle(point, 5, paint);
    }
  }

  @override
  bool shouldRepaint(PosePainter oldDelegate) {
    return oldDelegate.points != points;
  }
}
